package com.ljf.config.domain.service;

import com.ljf.common.exception.ServiceException;
import com.ljf.config.enums.ConfigDatKeyValueEnum;

import javax.annotation.Resource;
import java.util.List;

/**
 * 配置中心  领域服务
 *
 * @author LJF
 * @since 2024-12-18
 */
public abstract class AbstractConfigDatKeyValueDomainService<T extends ConfigDatKeyValueEnum> {

    @Resource
    private ConfigDatKeyValueDomainService service;

    /**
     * 通过关键字查询列表
     *
     * @param keyValueEnum
     * @return
     * @throws ServiceException
     */
    public List<String> getListByKey(T keyValueEnum) throws ServiceException {
        return service.getListByKey(keyValueEnum.getBelongService(), keyValueEnum.getTableKey(), keyValueEnum.getBusinessKey());
    }

    /**
     * 通过关键字查询值
     *
     * @param keyValueEnum
     * @return
     * @throws ServiceException
     */
    public String getStringByKey(T keyValueEnum) throws ServiceException {
        return service.getStringByKey(keyValueEnum.getBelongService(), keyValueEnum.getTableKey(), keyValueEnum.getBusinessKey());
    }

}
